struct Solution {}

fn main() {}

impl Solution {
    pub fn min_subsequence(nums: Vec<i32>) -> Vec<i32> {
        let mut nums_cp = nums.clone();
        nums_cp.sort();
        nums_cp.reverse();

        let mut sum_right = nums_cp.iter().sum();
        let mut sum_left = 0;
        let mut idx: usize = 0;
        while sum_left <= sum_right {
            if idx < nums_cp.len() {
                sum_left += nums_cp[idx];
                sum_right -= nums_cp[idx];
                idx += 1;
            }
        }
        return nums_cp[0..idx].to_vec();
    }
}